//
//  StartView.swift
//  JLDiaryApp
//
//  Created by Jiang Chencheng on 2024/9/25.
//

import SwiftUI

struct StartView: View {
    var body: some View {
        VStack {
            
            Spacer()
            
            NavigationLink {
                SignupView()
            } label: {
                Text("Get started")
                    .modifier(CapsuleTextModifier(textColor: .white))
            }
            
            NavigationLink {
                SigninView()
            } label: {
                Text("I already have an account")
                    .modifier(CapsuleTextModifier(textColor: .white))
            }


        }
        .background(Color("BackgroundColor"))
        .navigationBarBackButtonHidden()
    }
    
    
    
    struct CapsuleTextModifier: ViewModifier {

        var textColor: Color = .white
        var backgroundColor: Color = .white.opacity(0.2)
        
        func body(content: Content) -> some View {
            content
                .frame(maxWidth: .infinity)
                .padding()
                .foregroundStyle(textColor)
                .background(backgroundColor, in: Capsule())
                .padding(.horizontal)
        }
    }
    
    
}




#Preview {
    NavigationStack {
        StartView()
    }
}
